package com.beep.erp.model.earlystage;

import android.os.Bundle;
import android.support.design.widget.TabLayout;

import com.beep.erp.Constants;
import com.beep.erp.R;
import com.beep.erp.common.base.BaseViewPagerFragment;
import com.beep.erp.common.base.viewpage.ViewPageFragmentAdapter;
import com.beep.erp.model.earlystage.log.EarlyStageLogFragment;
import com.beep.erp.model.earlystage.option.EarlyStageOptionFragment;

/**
 * Created by Jolly on 2018/18/23.
 */

public class EarlyStageViewPageFragment extends BaseViewPagerFragment {

    @Override
    protected void onSetupTabAdapter(ViewPageFragmentAdapter adapter) {
        String[] strings = getResources().getStringArray(R.array.early_stage);
        adapter.addTab(strings[0], "log", EarlyStageLogFragment.class, getBundle(0));
        adapter.addTab(strings[1], "option", EarlyStageOptionFragment.class, getBundle(1));
        tabLayout.setSelectedTabIndicatorColor(getResources().getColor(R.color.blue));
        tabLayout.setSelectedTabIndicatorHeight(4);
        tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });
    }

    @Override
    protected void lazyLoad() {

    }

    private Bundle getBundle(int type) {
        Bundle bundle = new Bundle();
        bundle.putInt(Constants.BUNDLE_KEY_TYPE, type);
        return bundle;
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
